import fetch from 'utils/fetch';

export function page(query) {
  return fetch({
    url: '/api/shop/goods/promotion/admin/getPageList',
    method: 'get',
    params: query
  });
}

export function addObj(obj) {
  return fetch({
    url: '/api/shop/goods/promotion/admin/addPromotion',
    method: 'post',
    data: obj
  });
}

export function getObj(id) {
  return fetch({
    url: '/api/shop/goods/promotion/admin/' + id,
    method: 'get'
  })
}

export function delObjBatch(ids) {
  return fetch({
    url: '/api/shop/goods/promotion/admin/deletePromotionBatch?promotionIds=' + ids,
    method: 'delete'
  })
}

export function delObj(id) {
  return fetch({
    // url: '/api/shop/goods/promotion/admin/' + id,
    url: '/api/shop/goods/promotion/admin/deletePromotion/' + id,
    method: 'delete'
  })
}

export function putObj(id, obj) {
  return fetch({
    // url: '/api/shop/goods/promotion/admin/modifyPromotion/' + id,
    url: '/api/shop/goods/promotion/admin/modifyPromotion',
    method: 'put',
    data: obj
  })
}

export function getPromotionTypeList() {
  return fetch({
    url: '/api/shop/goodsPromotionType/front/getList',
    method: 'get'
  });
}